package com.sg.common;

import java.io.Serializable;

/**
 * 调用结果对象
 * <p>service层返回controller层的DTO,用于调用时装载返回结果,是否成功、返回信息、返回值</p>
 * @author Lwt
 * @param <T> 返回值类型
 */
public class InvokeResult implements Serializable{
	
	private static final long serialVersionUID = -785143356166749201L;

	/**
	 * 调用是否成功
	 */
	private boolean isSuccess;
	
	/**
	 * 消息
	 */
	private String message;
	
	/**
	 * 返回值
	 */
	private Object returnData;
	
	/**
	 * 无返回值结果构造函数
	 * @param isSuccess 是否调用成功
	 * @param message 返回消息
	 * @param exception 异常
	 */
	public InvokeResult(boolean isSuccess, String message){
		this.isSuccess = isSuccess;
		this.message = message;
	}
	
	/**
	 * 有返回值结果构造函数
	 * @param isSuccess 是否成功
	 * @param message 返回消息
	 * @param returnData 返回值
	 * @param exception 返回异常
	 */
	public InvokeResult(boolean isSuccess,final String message, Object returnData){
		this.isSuccess = isSuccess;
		this.message = message;
		this.returnData = returnData;
	}

	public boolean isSuccess() {
		return isSuccess;
	}

	public void setSuccess(boolean isSuccess) {
		this.isSuccess = isSuccess;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	} 

	public Object getReturnData() {
		return returnData;
	}

	public void setReturnData(Object returnData) {
		this.returnData = returnData;
	}
}
